<!--
Creator: Miroslav Milivojevic
-->


<?php

function printFeedbackStars($userID) {
    ?>
    <div class="rate_choice">
        <table>
            
            <?php
            require_once dirname(__FILE__) . '/db.php';
            include_once dirname(__FILE__) . '/staticStars.php';
            $conn = dbConnect("sib");
            $uid = $userID;

            $IDHostel = $_GET["hid"];

            $query = "SELECT Security, Location, Service, Fun, Cleanliness, Price FROM feedback WHERE IDHostel = $IDHostel AND IDUser = $uid;";
            $result = mysql_query($query, $conn);
            if (!$result)
                echo "Error:" . mysql_error();
            $row = mysql_fetch_array($result);
            ?>
            <tr>
                <td>Security: </td>
                <td>
                    <?php
                    $ss_security = new staticStars(round($row["Security"]));
                    echo $ss_security->printStars($row['Security']);
                    ?>
                </td>
            </tr>
            <tr>
                <td>Location: </td>
                <td>
                    <?php
                    $ss_security = new staticStars(round($row["Location"]));
                    echo $ss_security->printStars($row['Location']);
                    ?>
                </td>
            </tr>
            <tr>
                <td>Service: </td>
                <td>
                    <?php
                    $ss_security = new staticStars(round($row["Service"]));
                    echo $ss_security->printStars($row['Service']);
                    ?>
                </td>
            </tr>
            <tr>
                <td>Fun: </td>
                <td>
                    <?php
                    $ss_security = new staticStars(round($row["Fun"]));
                    echo $ss_security->printStars($row['Fun']);
                    ?>
                </td>
            </tr>
            <tr>
                <td>Cleanliness: </td>
                <td>
                    <?php
                    $ss_security = new staticStars(round($row["Cleanliness"]));
                    echo $ss_security->printStars($row['Cleanliness']);
                    ?>
                </td>
            </tr>
            <tr>
                <td>Price: </td>
                <td>
                    <?php
                    $ss_security = new staticStars(round($row["Price"]));
                    echo $ss_security->printStars($row['Price']);
                    ?>
                </td>
            </tr>
        </table>
    </div>
    <?php
}
?>
